home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Light ROM 1
/
LIGHT-ROM 1 (Amiga Library Services)(1994).iso
/
ffdisks
/
d968.lha
/
JustLook
/
Examples
/
ExampleSources
/
WBExecute.jl.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-12-04
|
2KB
|
77 lines
/* WBExecute.jl By Kamran Karimi.
Should be linked with JustLook (© Kamran Karimi) routines.
*/
#include <stdlib.h>
#include <stdio.h>
#include <intuition/intuition.h>
#include <clib/exec_protos.h>
#include <clib/dos_protos.h>
#include <clib/intuition_protos.h>
#include "JustLook.h"
struct RawInfo BackSp = {0x41,0};
struct RawInfo Command[] = { /* Avail FLUSH */
{0x20,LSHIFT}, {0x34,0}, {0x20,0}, {0x17,0}, {0x28,0}, {0x40,0},
{0x23,LSHIFT}, {0x28,LSHIFT}, {0x16,RSHIFT}, {0x21,RSHIFT}, {0x25,RSHIFT}
};
struct IntuitionBase *IntuitionBase;
#define Write_err printf("err = %08lx\n",err)
main()
{
struct Window *win1,*win2,*win3;
struct Gadget *StrGad;
struct StringInfo *StrInfo;
ErrorCode err;
struct ScrMap SM;
int count;
IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library",0);
if(IntuitionBase == 0) exit(100);
win1 = FindWindow("Workbench",NULL);
if(win1 > WIN_REPEATED)
{
err = IEDisable(MOUSE|KBD); Write_err; /* no fiddling! */
Delay(25);
ActivateWindow(win1); /* this is very important! */
printf("Mouse and keyboard disabled!\n");
InitSM(&SM,win1->WScreen);
Delay(50);
err = ChooseMenu(&SM,win1,0,1,-1); Write_err;
Delay(50);
win2 = FindWindow("Execute a File",NULL);
if(win2 > WIN_REPEATED)
{
StrGad = FindGad(win2,NULL,1);
StrInfo = (struct StringInfo *)StrGad->SpecialInfo;
if(StrInfo->BufferPos > 0)
for(count = StrInfo->BufferPos; count > 0;count--)
RawType(&BackSp,1,5); /* delete prev text */
Delay(25);
err = RawType(Command,11,20); Write_err;/* type 'Avail FLUSH' */
err = ClickGad(&SM,win2,NULL,2,1); Write_err; /* click Ok */
Delay(200); /* wait 4 seconds! */
win3 = FindWindow("Output Window",NULL);
if(win3 > WIN_REPEATED)
{
Delay(100);
WinAct(&SM,win3,CLOSEWIN);
}
else printf("Trouble finding Output Window!\n");
}
else printf("Trouble finding Window for File Execution!\n");
printf("Program ended!\n");
err = IEEnable(MOUSE|KBD); Write_err;
}
else printf("Trouble finding Workbench window!\n");
CloseLibrary((struct Library *)IntuitionBase);
exit(0);
}